package cz.possoft.explorer.resolver.method;

import java.util.Map;

import cz.possoft.explorer.meta.MethodMetadata;

/**
 * MethodResolver object can be used for working with Methods. Especially for obtaining names of permitted methods 
 * Method metadata and invoke method on given object.<br>
 * V is type of class for our object, which methods we need to obtain or invoke.<br>
 * C is type of class for key, which can be used to identify various Method types. 
 * 
 * @author <a href="mailto:mposolda@gmail.com">Marek Posolda</a>
 * @version $Revision$
 */
public interface MethodResolver<V,C>
{
   /**
    * Obtaining of all Methods and their metadada for some object and given class, which needs to be superclass of that object.
    * 
    * @param clazz - type of class, which is supertype of Object
    * @param object
    * @return map with all method metadata and their keys.
    */
   public Map<C, MethodMetadata> getMethods(Class<? super V> clazz, V object);

   /**
    * Invoking some method on given object.  
    * 
    * @param object Object where the method will be invoked
    * @param context identificator of the method 
    * @param params parameters of method to invoke
    * @return object which is result of our method.
    * 
    * @throws Exception
    */
   public Object invokeMethod(V object, C context, Object... params)  throws Exception; 
   
   /**
    * 
    * 
    * @return the class of the keys.
    */
   public Class<C> getKeyClass();

}

